import { Action } from '@ngrx/store';
import { DeviceModel } from '../entity/user.model';
// 权限相关
export const INIT_DEVICE= 'INIT_DEVICE'; // 设备信息

export const LOGIN_SUCCESS= 'LOGIN_SUCCESS'; // 登录成功
export const LOGIN_FAILED= 'LOGIN_FAILED'; // 登录失败
export const LOGOUT= 'LOGOUT'; // 登出

export const REGISTER_SUCCESS= 'REGISTER_SUCCESS'; // 注册成功

export const UPDATE_PASSWORD_SUCCESS= 'UPDATE_PASSWORD_SUCCESS'; // 更新密码成功

export class InitDeviceAction implements Action {
  readonly type= INIT_DEVICE;
  constructor(public payload: DeviceModel) {}
}
export class LoginSuccessAction implements Action {
  readonly type= LOGIN_SUCCESS;
  constructor(public payload: any) {}
}
export class LoginFailedAction implements Action {
  readonly type= LOGIN_FAILED;
  constructor(public payload: any) {}
}
export class LogoutAction implements Action {
  readonly type= LOGOUT;
}
export class RegisterSuccessAction implements Action {
  readonly type= REGISTER_SUCCESS;
  constructor(public payload: any) {}
}
export class UpdatePasswordSuccessAction implements Action {
  readonly type= UPDATE_PASSWORD_SUCCESS;
}

export type All= InitDeviceAction | LoginSuccessAction | LoginFailedAction
                  | LogoutAction | RegisterSuccessAction | UpdatePasswordSuccessAction;
